The Internet Group Management Protocol (IGMP) is designed for Internet Protocol version 4 (IPv4) multicast group management. It runs between a host and a multicast router directly connected to the host. The host tells the multicast router that it wants to join a certain multicast group via the protocol and the router regularly queries whether members of a known group in the local area network (LAN) are active (that is, whether there are still a member of a certain multicast group in the network segment); thus, collecting and maintaining group memberships of the connected network.
IGMP has three versions. IGMPv1 [RFC1112] defines the basic procedures for querying and reporting group memberships. IGMPv2 [RFC2236] is widely used at present, providing a mechanism for fast leave of a group member. IGMPv3 [RFC3376] adds the source filtering function, which enables a group member to designate to receive or not to receive packets from certain multicast sources.
The Multicast Listener Discovery (MLD) protocol is an extension of IGMP for Internet Protocol version 6 (IPv6) applications. MLD realizes the same functions as IGMP. MLD has two versions, MLDv1 and MLDv2, which correspond to IGMPv2 and IGMPv3, respectively.
In IGMPv3 or MLDv2, to support source-specific filtering, the protocol defines two filter modes: INCLUDE and EXCLUDE. In the INCLUDE mode, a multicast receiver receives packets only from specific sources. In the EXCLUDE mode, the receiver receives multicast packets only from resources other than the specific sources. The specific sources are defined in a source list.
The source filtering function defined in IGMPv3/MLDv2 improves the capability of expressing group members. A receiver may choose to receive or not to receive multicast packets from some sources. In IGMPv3, the source filtering function is implemented in a host system as follows:IPMulticastListen(socket,interface,multicast-address,filter-mode,source-list)  (1)
Socket is a parameter in an IPv4 system and is related to different requesting entities (a certain upper layer protocol or application); interface is a local identifier of the network interface, either physical or logical; multicast-address is the group address of the request; filter-mode is INCLUDE or EXCLUDE; and source-list is a list of unicast IP addresses of multicast sources from which the multicast receiver wants to (in the INCLUDE mode) or does not want to (in the EXCLUDE mode) receive packets.
In MLDv2, there is a similar expression:IPv6MulticastListen(socket,interface,IPv6 multicast-address,filter mode,source list)  (2)
The main difference between (2) and (1) is that the multicast addresses and the source list are represented in the form of IPv6 addresses. For descriptive purposes, the related technical solution herein is described on the basis of IGMPv3. The source filtering function in MLDv2 is equivalent to that in IGMPv3.
IGMP is an asymmetrical protocol, where a group member (normally on a host and occasionally on a router) behaves differently from a multicast router. An IGMPv3 host system stores the multicast group reception state in every socket and every interface so as to support source filtering. The state of a socket is the group reception wishes expressed by every application, that is, the application wishes to join which multicast group and filter which multicast source list at which interface in which filter mode. The group reception state of an interface is a combination of the group reception states of all sockets on the interface. The host may generate an IGMPv3 state report and respond to a request of the connected router for querying group memberships according to the group reception state and state change on the interface.
An IGMPv3-enabled router also needs to store the group reception state of the connected network. The concept model is:(multicast address,group timer,filter-mode,(source records))  (3)
The multicast address is a group address associated with the state record; the filter-mode is defined by the router, and is recorded as EXCLUDE if the router receives a report that indicates the EXCLUDE mode; the group timer is effective in the EXCLUDE mode, indicating the timeout interval for the filter mode of the group to change from EXCLUDE to INCLUDE; the source record is represented in the form of (source address, source timer); the source address is the address of the multicast source the host wishes to receive packets from; and the source timer defines the timeout interval for receiving packets from the source address.
IGMPv3 and MLDv2 support source filtering, which increases the flexibility of group joining. Especially, the INCLUDE mode is defined to support the Protocol Independent Multicast-Source Specific Multicast routing protocol. However, the adoption of filter modes is also subject to weaknesses:
(1) Complex mode setting and switching: A router has to set and switch the filter mode according to the change of the group reception state of the connected system, and the setting and switching are closely related to the state of the source/group timer and require complex judgment logics. The protocol implementation is inconvenient.
(2) The EXCLUDE mode does not fully meet the requirements of actual applications: On the one hand, it is rare that an application does not want to receive multicast packets from one or more sources in a multicast application system. On the other hand, even if there is a scenario where the host connected to one interface of the router does not want to receive multicast packets from a certain source, it is quite possible that other hosts in the network wish to receive data of this source. In this case, the router must also forward packets from this source. Therefore, the effect of the EXCLUDE mode is limited.